<template>
	<view class="page index">
		<view class="header">
			<nav-bar title="意见箱"></nav-bar>
		</view>
		<view class="main">
			<view class="scroll">
				<scroll-view class="srollX" :scroll-x="true" scroll-y="true">
					<view :class="countIndex===index?'srollItem scrollItemBefore1':'srollItem'"
						v-for="(item,index) in fence" :key="index" @click="clickCountIndex(index)">
						<text>{{item.title}}</text>
					</view>
				</scroll-view>
			</view>
			<view class="section">
				<view class="inpnts">
					<view class="inpnts_search">
						<uni-icons type="search" size="40rpx" color="#8e8e8e"></uni-icons>
						<input type="text" class="input_text">
					</view>
				</view>
				<view class="comment-content">
					<Comment v-for="(item,index) in ideaList[countIndex]" :key="index" :obj="item" />
				</view>
			</view>
			<view v-if="countIndex==1" class="upSubmit">
				<text>上报</text>
			</view>
		</view>
	</view>
</template>

<script>
	import Comment from "./Comment/index.vue";
	export default {
		components: {
			Comment,
		},
		data() {
			return {
				countIndex: 0,
				fence: [{
						title: '公告栏'
					},
					{
						title: '我的意见'
					}
				],
				ideaList: {
					0: [{
							content: '投诉内容投诉内容投诉内容投诉内容投诉内容投诉内',
							date: '2023-03-01 12:20:02',
							type: '投诉举报',
							reply: 'XXXXXXXXXXXXXX'
						},
						{
							content: '意见内容意见内容意见内容意见内容意见内容意见内容',
							date: '2023-03-01 12:20:02',
							type: '意见建议',
							reply: 'XXXXXXXXXXXXXX'
						}
					],
					1: [{
							content: '提问内容提问内容提问内容提问内容提问内容提问内容',
							date: '2023-03-01 12:20:02',
							type: '问题咨询',
							isDefine: false,
							reply: 'XXXXXXXXXXXXXX'
						},
						{
							content: '投诉内容投诉内容投诉内容投诉内容投诉内容投诉内',
							date: '2023-03-01 12:20:02',
							type: '投诉举报',
							isDefine: true,
							reply: 'XXXXXXXXXXXXXX'
						}
					]
				}
			}
		},
		methods: {
			clickCountIndex(idx) {
				this.countIndex = idx;
				console.log(this.ideaList[idx]);
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import '@/common/style/common.scss';
	@import 'index.scss';
</style>